﻿<%@ Page Title="" Language="C#" MasterPageFile="~/VSFuncionario.Master" AutoEventWireup="true" CodeBehind="GradeConsulta.aspx.cs" Inherits="Presentation.GradeConsulta" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p>
        &nbsp;</p>
    <p>
        <asp:Label ID="LblTitulo" runat="server" Text="Lista de Grades Cadastradas"></asp:Label>
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ID" DataSourceID="SqlDataSource1" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="ID" InsertVisible="False" />
                <asp:BoundField DataField="Curso" HeaderText="Curso" SortExpression="Curso" />
                <asp:BoundField DataField="Ano" HeaderText="Ano" 
                    SortExpression="Ano" />
                <asp:BoundField DataField="Semestre" HeaderText="Semestre" 
                    SortExpression="Semestre" />
                <asp:CommandField ShowEditButton="True" />
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <EmptyDataTemplate>
                Não foi encontrada nenhuma Grade cadastrada.
            </EmptyDataTemplate>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:DBUCNConnectionString %>" 
            DeleteCommand="DELETE FROM [TBGrade] WHERE [ID] = @original_ID AND (([Ano] = @original_Ano) OR ([Ano] IS NULL AND @original_Ano IS NULL)) AND (([Semestre] = @original_Semestre) OR ([Semestre] IS NULL AND @original_Semestre IS NULL))" 
            InsertCommand="INSERT INTO [TBGrade] ([ID], [Ano], [Semestre]) VALUES (@ID, @Ano, @Semestre)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT TBGrade.ID, TBCurso.Nome AS Curso, TBGrade.Ano, TBGrade.Semestre FROM TBGrade INNER JOIN TBCurso ON TBGrade.IDCurso = TBCurso.ID" 
            
            UpdateCommand="UPDATE [TBGrade] SET [Ano] = @Ano, [Semestre] = @Semestre WHERE [ID] = @original_ID AND (([Ano] = @original_Ano) OR ([Ano] IS NULL AND @original_Ano IS NULL)) AND (([Semestre] = @original_Semestre) OR ([Semestre] IS NULL AND @original_Semestre IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_ID" Type="Int32" />
                <asp:Parameter Name="original_Ano" Type="Int32" />
                <asp:Parameter Name="original_Semestre" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="Ano" Type="Int32" />
                <asp:Parameter Name="Semestre" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Ano" Type="Int32" />
                <asp:Parameter Name="Semestre" Type="String" />
                <asp:Parameter Name="original_ID" Type="Int32" />
                <asp:Parameter Name="original_Ano" Type="Int32" />
                <asp:Parameter Name="original_Semestre" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>
